package com.pgy.backend.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.pgy.backend.entity.EvaluateRecords;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface EvaluateRecordsMapper extends BaseMapper<EvaluateRecords> {

    @Select("SELECT * FROM evaluate_records WHERE teach_id =#{id} and status = 0")
    List<EvaluateRecords> findRecords(@Param("id") Long id);

    @Delete("delete from evaluate_records where teach_id = #{teachId} and pointer_id = #{pointerId} and status = 2")
    Boolean deleteByIds(Long teachId, String pointerId);


    @Select("select teach_id from evaluate_records where status = 0 group by teach_id")
    List<Long> selectIds();

    @Update("update evaluate_records set status = 0 where teach_id = #{teachId} and pointer_id = #{pointerId}")
    void updateByIds(Long teachId, String pointerId);
}
